﻿using JWTAuthServer.Model;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; 

namespace JWTAuthServer.Controllers
{
    [Authorize]
    [ApiController]    
    [Route("[controller]/[action]")]  
    public class UserController : ControllerBase
    {
        [HttpGet]
        public TResponse GetUserList()
        {
            var aaa = HttpContext.User.Claims;
            var list = Enumerable.Range(1, 5).Select(index => new User
            {
                CreateTimne = DateTime.Now.AddDays(index),
                UserName ="Lee " + Random.Shared.Next(-20, 55),
                Pwd = Guid.NewGuid().ToString(),
             }).ToList();

           return new TResponse<List<User>>() {data = list,total=list.Count };
        }
    }
}
